* Hard Disk Protector v1.0 by Jedi/Sector 0ne
* Protects Your C: Partition Against Format & Writting
* E-Mail: Frank.Denis@epita.edu

        real

        org $100

        move #$201,a
        push cs
        pop es
        move #$80,d             $80 = Master HDD, $81 = Slave HDD
        move #1,c
        move #buffer,b
        trap #$13
        push cs
        pop ds
        move #buffer+$1bf,si    $1bf = C:, $1cf = D:, ...
        move.b (si),a
        move.b a,heya+2
        move 1(si),a
        move a,heya3+2
        move.b 4(si),a
        move.b a,heya2+2
        move 5(si),a
        move a,heya4+2

        move #$3513,a
        trap #$21
        move es,youpla+3
        move b,youpla+1
        move #zippo,d
        push cs
        pop ds
        move #$2513,a
        trap #$21
        move #credits,d
        move.b #9,ah
        trap #$21
        move #@zefin,d
        move #$3100,a
        trap #$21

credits dc.b "Hard Disk Protector v1.0 by Jedi/Sector 0ne",13,10
        dc.b '$'

zippo   cmp.b #5,ah
        beq.s hey
        cmp.b #3,ah
        beq.s yoplou
        cmp.b #$b,ah
        beq.s yoplou
youpla  braf 0
yoplou  cmp.b #$80,d
        bne.s youpla
heya    cmp.b #0,dh
        blt.s youpla
heya2   cmp.b #0,dh
        bgt.s youpla
heya3   cmp #0.w,c
        blt.s youpla
heya4   cmp #0.w,c
        bgt.s youpla

hey     pusha
        xor.b a,a
        move #$3c8,d
        out.b a,d
        inc d
        out.b a,d
        out.b a,d
        move.b #16,a
        out.b a,d
        popa
        move.b #1,ah
        stc
        rte

        segment
zefin
buffer  ds.l 128
